import pandas as pd
import datetime

# df = pd.read_csv('path', sep=',', delimiter=None, header='infer',
#                  names=None, index_col=None, usecols=None, squeeze=False, prefix=None,
#                  mangle_dupe_cols=True, dtype=None, engine=None, converters=None,
#                  true_values=None, false_values=None, skipinitialspace=False,
#                  skiprows=None, nrows=None, na_values=None, keep_default_na=True,
#                  na_filter=True, verbose=False, skip_blank_lines=True, parse_dates=False,
#                  infer_datetime_format=False, keep_date_col=False, date_parser=None,
#                  dayfirst=False, iterator=False, chunksize=None, compression='infer',
#                  thousands=None, decimal=b'.', lineterminator=None, quotechar='"',
#                  quoting=0, escapechar=None, comment=None, encoding=None, dialect=None,
#                  tupleize_cols=False, error_bad_lines=True, warn_bad_lines=True,
#                  skipfooter=0, skip_footer=0, doublequote=True, delim_whitespace=False,
#                  as_recarray=False, compact_ints=False, use_unsigned=False,
#                  low_memory=True, buffer_lines=None, memory_map=False, float_precision=None)

# 解析时间的函数名，默认为None
# 指定时间解析库，默认是dateutil.parser.parser
# date_parser = lambda x: pd.to_datetime(x, utc=True, format='%d%b%Y')

#列名重命名 ，设置任意列为索引

# df = pd.read_csv('/Users/user/PycharmProjects/text1/files/Export-ID-115213036186490-2023-10-07T07_00_00-2023-10-07T23_59_59-D84-BATTERY-AND-VHB-INSTALL-Versions-3.csv' ,
#                  skiprows=[0,2,3,4,5,6,7,8,9] ,header=0,usecols=['StartTime' ,'Dynamic_Rolling_Time' ] ,dtype={'Dynamic_Rolling_Time' : float} ,parse_dates = ['StartTime']  ,dayfirst = True)
#
# print(df.columns)
# print(df.head(20))




df2 = pd.read_csv('/Users/user/PycharmProjects/text1'
                 '/files/Stratification-2023-09-30T00_00_00-2023-10-14T23_59_59-D84.csv',index_col = [7,8 ] , skiprows=[0,2,3,4,5,6,7,8,9] ,header=0 , thousands= ',')
print(df2.columns)
df2 = df2.T

print(df2)
df2.to_excel("wejian.xlsx")
df2_col = df2.columns.tolist()
df3 = df2[df2_col[2]]
df3.to_excel('wenjan2.xlsx')
